loadJS('config.js?v='+new Date().getTime(),function () {
  var config = win.config;
  if(!config){
    console.error('no config file!');
    return;
  }
  if(!config.staticDomain){
    console.error('no config.staticDomain!');
    return;
  }
  if(!config.projectName){
    console.error('no config.projectName!');
    return;
  }
  var staticIndexJs = config.staticDomain + '/static/' + config.projectName + '/js/index.js?v='+new Date().getTime();
  loadJS(staticIndexJs);
});

/*动态加载js*/
function loadJS(url, success) {
  var domScript = document.createElement('script');
  domScript.src = url;
  success = success || function(){};
  domScript.onload = domScript.onreadystatechange = function() {
    if (!this.readyState || 'loaded' === this.readyState || 'complete' === this.readyState) {
      success();
      this.onload = this.onreadystatechange = null;
      this.parentNode.removeChild(this);
    }
  }
  document.getElementsByTagName('head')[0].appendChild(domScript);
}
